<template>
  <div>
    <tr>
      <th>欢迎光临vue_开发的收银系统_水果店</th>
    </tr>
    <tr>
      <td>苹果{{ msg }}元/斤，折扣  {{ zk }}折</td>
    </tr>
    <tr>
      <td>请输入你要购买的斤数：<input type="text" v-model="count"></td>
    </tr>
    <tr>
      <td><button @click="btn">结账买单</button></td>
    </tr>
    <tr>
      <td>结账单：总价{{ zj }}元 折扣价：{{ zkj }}元 省了:{{ sl }}元</td>
    </tr>
  </div>
</template>

<script>
export default {
  data(){
    return{
      count:"",
      msg:100,
      zk:0.98,
      zj:"",
      zkj:"",
      sl:""
    }
  },
  methods:{
    btn(){
      this.zj=this.count * this.msg
      this.zkj=this.count * this.msg * this.zk   
      this.sl=this.zj-this.zkj
    }
  }
}
</script>

<style>
  td{
    width: 500px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    border: 1px solid #000;
    
  }
</style>